
#include <iostream>
#include <unordered_set>
using namespace std;
class Solution
{
public:
    vector<int> intersection(vector<int> &nums1, vector<int> &nums2)
    {
        unordered_set<int> s1, s2;
        for (auto e : nums1)
            s1.insert(e);
        for (auto e : nums2)
            s2.insert(e);
        vector<int> ans;
        for (auto e : s1)
            if (s2.count(e))
                ans.push_back(e);
        return ans;
    }
};